import React from 'react';
import PropTypes from 'prop-types';

class Hidemessage extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            hidden: (props.hidden) ? "block" : "none"
        }
    }
    
    componentWillReceiveProps(nextProps) {
        this.setState({ hidden: (nextProps.hidden) ? "block" : "none" });
    }
    render() {
        const { message } = this.props;
        const { hidden } = this.state;
        return (
            <div className="message" style={{ display: hidden }}>
                <h2>{message}</h2>
            </div>
        )
    }
}
export { Hidemessage };